import request from "@/utils/request";

// 修改投放规则
export function advertisementRuleApiruleupdate(data) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/update`,
    method: "post",
    data,
  });
}
// 查询投放规则（1字幕 2图片 3特价新品 4商品广告）
export function advertisementRuleApirule(type) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule?type=${type}`,
    method: "get",
  });
}

// p通商品品类列表
export function categoryListNormal() {
  return request({
    url: `/backAdmin/advertisementRuleApi/category/list/normal`,
    method: "get",
  });
}
// 特价
export function categoryListSpecial() {
  return request({
    url: `/backAdmin/advertisementRuleApi/category/list/special`,
    method: "get",
  });
}

// 查询排名
export const advertisementRuleApiRuleSort = () => {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/sort`,
    method: "get",
  });
};

export function ruleCategory(type) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/category?type=${type}`,
    method: "get",
  });
}

export function ruleCategoryChange(data) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/category`,
    method: "post",
    data,
  });
}

export function rulePosition(type) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/position?type=${type}`,
    method: "get",
  });
}
export function rulePositionChange(data) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/position`,
    method: "post",
    data,
  });
}

export function ruleScope(type) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/scope?type=${type}`,
    method: "get",
  });
}
export function ruleScopeChange(data) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/scope`,
    method: "post",
    data,
  });
}

export function ruleSort() {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/sort`,
    method: "get",
  });
}

export function ruleSortChange(rankList) {
  return request({
    url: `/backAdmin/advertisementRuleApi/rule/sort?rankList=${rankList}`,
    method: "post",
  });
}
